<!DOCTYPE html>
<html>
<?php $this->load->view('admin/public/header.html');?>
<style>
	. space{padding:10px;}

</style>
<body class="childrenBody">
<form class="layui-form layui-row layui-col-space20" lay-filter="expert_form">
	<div class="layui-col-md6 layui-col-xs12 ">
		<div class="layui-row layui-col-space10">
			<div class="layui-col-md12 layui-col-xs7">
								
				<div class="layui-form-item magt3">
					<div class="layui-row layui-col-space10">
						<div class="layui-col-md6 layui-col-xs6">
							<label class="layui-form-label">公司营业执照</label>
							<div class="layui-upload-list thumbBox posterBox mag0 magt3">
								<img class="layui-upload-img thumbImg posterimg"  src="<?php echo  NULL!==$user['companyImg']?IMAGEHOST.$user['companyImg']:''?>">
								<input type="hidden" class="poster" name="companyImg">
							</div>
						</div>						
					</div>
				</div>				
								
				<div class="layui-form-item magt3">
					<label class="layui-form-label">真实姓名</label>
					<div class="layui-input-block">
						<input type="hidden" name="userId" value="<?php echo @$user['userId']?>">
						<input type="text" class="layui-input name" name="realName" value="<?php echo @$user['realName']?>" lay-verify="required"  >
					</div>
				</div>
				
				
				<div class="layui-form-item magt3">
					<label class="layui-form-label">手机号</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input name" lay-verify="required"  value="<?php echo @$user['phone']?>"  disabled>
					</div>
				</div>
				
				<div class="layui-form-item magt3">
					<label class="layui-form-label">身份证号</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input name" name="id_number" value="<?php echo @$user['id_number']?>" lay-verify="required"  >
					</div>
				</div>
				
				<div class="layui-form-item magt3">
					<label class="layui-form-label">公司名称</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input name" name="companyName"  value="<?php echo @$user['companyName']?>" lay-verify="required"  >
					</div>
				</div>
				
				<div class="layui-form-item magt3">
					<label class="layui-form-label">公司信用代码</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input name" name="companyNum"  value="<?php echo @$user['companyNum']?>" lay-verify="required"  >
					</div>
				</div>
				
				<div class="layui-right">
					<a class="layui-btn layui-btn-sm" lay-filter="save" lay-submit><i class="layui-icon">&#xe609;</i>保存</a>
				</div>
			</div>
		</div>
		
	</div>
	
</form>
<script type="text/javascript">

layui.use(['form','layer','upload'],function(){
	
    var form = layui.form
        layer =  layui.layer ,     
        upload=layui.upload,
        $ = layui.jquery;

  //上传缩略图
    upload.render({
        elem: '.posterBox',
        //multiple:true,
        url: '<?php echo site_url("upload/upload")?>',
        before: function(obj){ //obj参数包含的信息，跟 choose回调完全一致，可参见上文。
        	layerindex=layer.load(); //上传loading
        },
        done: function(res, index, upload){
        	layer.close(layerindex);
            if(res.code==200){
            	layer.msg('上传成功');
            	var url=res.content.url
            	var src='<?php echo IMAGEHOST?>'+url;
            	$('.posterimg').attr('src',src);
                $('.thumbBox').css("background","#fff"); 
                $(".poster").val(url);
            }else{
            	layer.msg('上传失败');
            }
        }
    });
    form.on("submit(save)",function(data){
    	
        var index = layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
        
        $.ajax({
        	type:'post',
        	data:data.field,
        	url:'<?php echo site_url("seller/user/cert")?>',
        	dataType: "json", 
        	success:function(res){
        		//console.log(res.code);return;
        		if(res.code==200){
        			layer.close(index);
                    layer.msg("操作成功！");                    
                    
        		}else{
        			layer.close(index);
                    layer.msg("操作失败！");
        		}
        	},
        	fail:function(){
        		layer.close(index);
                layer.msg("操作失败！");
        	}
        })        
        
    })

})
</script>
</body>
</html>